package com.example.day18_7_18_1.presenter;

import android.util.Log;

import com.example.day18_7_18_1.bean.Bean;
import com.example.day18_7_18_1.model.Model;
import com.example.day18_7_18_1.view.IView;

public class Presenter implements IPresenter, ResultBack<Bean> {
    private IView<Bean> iView;
    private final Model model;

    public Presenter(IView<Bean> iView) {
        this.iView = iView;
        model = new Model();
    }

    @Override
    public void getData() {
        model.getData(this);
    }

    @Override
    public void succeed(Bean bean) {
        iView.setData(bean);
    }

    private static final String TAG = "Presenter";
    @Override
    public void failed(String string) {
        Log.i(TAG, "failed: " + string);
    }
}
